﻿using IterationLife.Educations.Models;
using Util;
using Util.Maps;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.Educations {
    /// <summary>
    /// 能力类型数据传输对象扩展
    /// </summary>
    public static class AbilityTypeDtoExtension {
        /// <summary>
        /// 转换为能力类型实体
        /// </summary>
        /// <param name="dto">能力类型数据传输对象</param>
        public static AbilityType ToEntity( this AbilityTypeDto dto ) {
            if ( dto == null )
                return new AbilityType();
            return dto.MapTo( new AbilityType( dto.Id.ToGuid() ) );
        }
        
        /// <summary>
        /// 转换为能力类型数据传输对象
        /// </summary>
        /// <param name="entity">能力类型实体</param>
        public static AbilityTypeDto ToDto(this AbilityType entity) {
            if( entity == null )
                return new AbilityTypeDto();
            return entity.MapTo(new AbilityTypeDto());
        }
    }
}
